<?php
  require_once '../../Helpers/PathHelper.php';
  require_once '../../Controllers/UserController.php';
  require_once '../../Controllers/StudentController.php';
  require_once '../../Controllers/SchoolController.php';
  require_once '../../Helpers/DbHelper.php';
  //
  $u = new UserController();
  $u->evaluatePagePermission(UserController::ADMINISTRATOR);
  //
  $s = new StudentController();
  $sId = $_POST['student-id'];
  $s->read($sId);
  //
  $sDetails = mysql_fetch_assoc($s->read($sId));
  $id = $sDetails['DepartmentId'];
  //
  if($id == SchoolController::PRE_ELEMENTARY)
   header('Location:../Enrolments/update_prelem.php?id='.$sId);
  else if($id == SchoolController::ELEMENTARY)
    header('Location:../Enrolments/update_elem.php?id='.$sId);


?>
<html>
	<head>
	  <title>School Enrollment :: Search Student</title>
    <?php
      require_once '../commons.php';
      renderHeaderStyles() ;
    ?>	</head>
	<body>
	<div class="admin-container">
	  <?php renderAdminNav(); ?>
	</div>
	<div class="container">
		<form method="POST">
			<table cellpadding="0" align="center" class="table">
				<tr>
				  <td><h1>Search Student</h1></td>
				</tr>
				<tr>
					<td>
						<label for="student-id">ID:</label>
					</td>
				  <td>
					<input type="text" name="student-id" /><br /><br />
				</td>
				<td>
					<input type="submit" name="search" value="Search" />
				</td>
				</tr>
			</table>
		</form>
			<?php
				if(isset($_GET['student-id']))
				{
					echo 'ID does not exist.  Please try again.';
				}
			?>
		<a href="<?php echo PathHelper::getBaseUrl() ?>/Views/Enrolments/enrolment_form.php" id="prev-next">Proceed to Enrolment &rarr;</a>
		</div><!--end of container>-->
	</body>
</html>